// 解构断言
function test() {
    var a = 'coderzrf';
    var b = function (x, y) { return x + y; };
    // return [a, b] as [typeof a, typeof b]
    return [a, b]; // 等同于上行代码 放到外面无效
}
// let [n, m] = test() as [string, Function]
// console.log((m as Function)(1, 2))
var _a = test(), n = _a[0], m = _a[1];
console.log(m(1, 2));
{
    // 非空断言
    var el = document.querySelector('.main');
    // let el: HTMLDivElement = document.querySelector('.main')! // 感叹号去空
    el.innerHTML = '555';
    // class构造函数强制断言
    var Test = /** @class */ (function () {
        function Test(el) {
            this.el = el;
        }
        Test.prototype.html = function () {
            console.log(this.el.innerHTML);
        };
        return Test;
    }());
    var ele = document.querySelector('.main');
    new Test(ele).html();
    // DOM事件处理
    var btn = document.querySelector('.btn');
    btn.addEventListener('click', function (e) {
        e.preventDefault();
        var body = document.querySelector('body');
        body.insertAdjacentHTML('beforeend', '<h1>Helllo</h1>');
    });
}
